package zhtt.jasperreports02.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class MysqlUtils {
    private static String driverClassName = "com.mysql.jdbc.Driver";
    private static String username = "zhtt";
    private static String password = "zhtt";
    private static String url = "jdbc:mysql://localhost/zhtt?useSSL=false";

    static {
        try {
            Class.forName(driverClassName);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

    public static Connection getConnection() {
        try {
            return DriverManager.getConnection(url, username, password);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}